/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package td4;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.Socket;
import java.net.UnknownHostException;


/**
 *
 * @author ?
 */
public class CommunicaTcpClient {
    
    public static void main(String[] arg) {
		int portEcouteServeur = 10302;
		BufferedReader entree;
		PrintStream sortie;
		String host;
		Socket connection;
		try {
			connection = new Socket(arg[1], portEcouteServeur);
			
                        entree = new BufferedReader(new InputStreamReader(connection.getInputStream()));
			sortie = new PrintStream(connection.getOutputStream());
		        sortie.flush();
                        sortie.close();
		        entree.close();
			connection.close();
		}
		catch(FileNotFoundException exc) {
			System.out.println("Fichier introuvable");
		}
		catch(UnknownHostException exc) {
			System.out.println("Destinataire inconnu");
		}
		catch(IOException exc) {
			System.out.println("Probleme d'entree-sortie");
		}
	}
    
}
